package com.xidian.yunwudemo.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xidian.yunwudemo.common.Result;
import com.xidian.yunwudemo.entities.DataAdaptive;
import com.xidian.yunwudemo.service.AdaptiveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author voidwx
 * @Description 自适应认证controller
 * @Date 15:54 2022/5/5
 **/

@RestController
@RequestMapping("/adaptiveData")
public class AdaptiveController {
    @Autowired
    AdaptiveService adaptiveService;

    @GetMapping("/adaptiveResult")
    public Result getAdaptiveData(@RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize){
        PageHelper.startPage(pageNum,pageSize);
        List<DataAdaptive> data = adaptiveService.getAllData();
        PageInfo<DataAdaptive> res = new PageInfo<DataAdaptive>(data);
        return Result.OK(res);
    }
}
